#!/bin/sh

spiderdir="/home/www/mySpider/gaokaopai"
logdir="/home/www/mySpider/gaokaopai"

function scrapy(){
    count=`ps -ef |grep "gaokaopai_data" |grep -v "grep" |grep -v "gaokaopai_data.sh" |wc -l`

    data=`date +%d_%H_%M`

    echo $count
    if [ 0 == $count ];then
        cd $spiderdir
        nohup /usr/local/bin/scrapy crawl gaokaopai_data > $logdir/gaokaopai_data_$data.log 2>&1 &
    fi
}

scrapy